package dp;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * 小熊猫分竹子
 */
public class Bear {
    /*
        public static void main(String[] args) {
            // 1. 读入数据并排序
            Scanner scanner = new Scanner(System.in);
            int n = scanner.nextInt();
            int a = scanner.nextInt();
            int b = scanner.nextInt();
            int c = scanner.nextInt();
            List<Integer> sizeList = new ArrayList<>();
            sizeList.add(a);
            sizeList.add(b);
            sizeList.add(c);
            sizeList.sort((item1, item2) -> {
                return item1 - item2;
            });
            a = sizeList.get(0);
            b = sizeList.get(1);
            c = sizeList.get(2);
            //2.
            int count = n / a;
            if (n % a == 0) {
                System.out.println(count);
            } else {//有剩余
                for (; count >= 0; count--) {
                    int left = n - count * a;
                    for (int i = left / b; i >= 0; i--) {
                        for (int j = 0; j <= left / c; j++) {
                            if (b * i + c * j == left) {
                                System.out.println(count + i + j);
                            }
                        }
                    }

                }
            }
        }
    */
    // 动态规划
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int a = scanner.nextInt();
        int b = scanner.nextInt();
        int c = scanner.nextInt();
        List<Integer> sizeList = new ArrayList<>();
        sizeList.add(a);
        sizeList.add(b);
        sizeList.add(c);
        sizeList.sort((item1, item2) -> {
            return item1 - item2;
        });
        int[] dp = new int[n + 1];
        dp[sizeList.get(0)] = 1;
        dp[sizeList.get(1)] = 1;
        dp[sizeList.get(2)] = 1;
        for (int i = sizeList.get(0) + 1; i <= n; i++) {
            int cur = dp[i];
            for (int j = 0; j < 3; j++) {
                int prev = i - sizeList.get(j);
                if (prev >= 0 && dp[prev] > 0) {
                    dp[i] = Math.max(dp[i], dp[prev] + 1);
                }
            }
        }
        System.out.println(dp[n]);

        
    }
}
